//
//  StatusCell.m
//  weibo3
//
//  Created by Tian Wu on 11-4-13.
//  Copyright 2011年 nfsysu. All rights reserved.
//

#import "StatusCell.h"
#import <iso646.h>
#import "weibo3AppDelegate.h"

extern RootViewController *rootView;

@implementation StatusCell


@synthesize img, name, time, text, pic, thisStatus;


#pragma mark -
#pragma mark Init/Dealloc

- (id)initWithReusableIdentifier: (NSString*)identifier
{
	if((self = [super initWithReusableIdentifier:identifier]))
	{
	}
	
	return self;
}

- (void)dealloc
{
	[name release], name=nil;
    [img release], img=nil;
    [time release], time=nil;
    [text release], text=nil;
    [pic release], pic = nil;
    [thisStatus release], thisStatus = nil;
    
	[super dealloc];
}

- (IBAction) didViewUserTimeline:(id) sender{
    
    [rootView refreshFriendsStatusWithUserid:[[self.thisStatus user] uid] Page:1];
}

#pragma mark -
#pragma mark Reuse

- (void)prepareForReuse
{
	[name setStringValue:@""];
    [text setStringValue:@""];
    [time setStringValue:@""];
    [img setImage:nil];
    [pic setImage:nil];
    
}


#pragma mark -
#pragma mark Drawing

- (void)drawRect:(NSRect)dirtyRect
{
	if([self isSelected]) {
		[[NSColor colorWithCalibratedRed:0.95 green:0.95 blue:0.95 alpha:0.88] set];
	}
	else {
		[[NSColor colorWithCalibratedRed:0.95 green:0.95 blue:0.95 alpha:0.98] set];
    }
    
    //Draw the border and background
	NSBezierPath *roundedRect = [NSBezierPath bezierPathWithRoundedRect:[self bounds] xRadius:0.0 yRadius:0.0];
	[roundedRect fill];
}

@end